package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.dto.ReplyDTO;
import com.tianji.learning.domain.po.InteractionReply;
import com.tianji.learning.domain.query.ReplyPageQuery;
import com.tianji.learning.domain.vo.ReplyVO;
import com.tianji.learning.service.IInteractionReplyService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 * 互动问题的回答或评论 前端控制器
 * </p>
 *
 * @author 东哥
 * @since 2024-06-25
 */
@Slf4j
@RestController
@RequestMapping("/replies")
@RequiredArgsConstructor
public class InteractionReplyController {

    private final IInteractionReplyService interactionReplyService;
    @ApiOperation("分页查询互动回答或评论")
    @GetMapping("page")
    public PageDTO<ReplyVO> pageQuery(ReplyPageQuery query){
        return interactionReplyService.pageQuery(query);
    }

    /**
     * 新增互动回答或评论
     * @param replyDTO
     */
    @ApiOperation("新增互动回答或评论")
    @PostMapping
    public void saveReply(@Valid @RequestBody ReplyDTO replyDTO){
        interactionReplyService.saveReply(replyDTO);
    }
}
